/** @license
 * MIT License
 *
 * Copyright (c) 2018
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
import React from 'react'
import { View, Button } from '@tarojs/components'
import Header from '../../../../components/head/head'

import './index.scss'

export default class PageButton extends React.Component {
  state = {
    btn: [
      {
        text: '页面主操作 Normal',
        size: 'default',
        type: 'primary'
      },
      {
        text: '页面主操作 Loading',
        size: 'default',
        type: 'primary',
        loading: true
      },
      {
        text: '页面主操作 Disabled',
        size: 'default',
        type: 'primary',
        disabled: true
      },
      {
        text: '页面次要操作 Normal',
        size: 'default',
        type: 'default'
      },
      {
        text: '页面次要操作 Disabled',
        size: 'default',
        type: 'default',
        disabled: true
      },
      {
        text: '警告类操作 Normal',
        size: 'default',
        type: 'warn'
      },
      {
        text: '警告类操作 Disabled',
        size: 'default',
        type: 'warn',
        disabled: true
      }
    ]
  }
  render() {
    return (
      <View className='components-page'>
        <View className='components-page__header'>
          <Header title='Button'></Header>
        </View>
        <View className='components-page_body'>
          <View className='example'>
            {this.state.btn.map(item => {
              return (
                <Button
                  size={item.size ? item.size : ''}
                  type={item.type ? item.type : ''}
                  loading={item.loading ? item.loading : false}
                  disabled={item.disabled ? item.disabled : false}>
                  {item.text}
                </Button>
              )
            })}
            <Button plain type='primary'>按钮</Button>
            <Button plain type='primary' disabled>不可点击的按钮</Button>
            <Button plain>镂空按钮</Button>
            <Button plain disabled>镂空按钮 Disabled</Button>
            <View className='btn-center'>
              <Button size='mini' type='primary'>小号按钮</Button>
              <Button size='mini'>小号按钮</Button>
              <Button size='mini' type='warn'>小号按钮</Button>
            </View>
          </View>
        </View>
      </View>
    )
  }
}
